# Copyright 2009 http://www.yuntien.com
# Licensed under the Apache License, Version 2.0

from ytblog.controller.common import *
    
class BlogCommentController(BlogController):
  @check_blog_id
  @authorize(Comment, authorization.OPERATION_ADD)
  def post(self, id):
    blog = Blog.get_by_str_id(id)
    comment = Comment(blog=blog)
    comment.author = users.get_current_user()
    comment.content = self.request.get('commentdata')
    comment.put()
    blog.put()

    self.redirect(self.request.referer)
